<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <div id="box">
    <button>按钮</button>
  </div>

  <script>
    function clickButton () {
      console.log('点击');
    }
    document.body.querySelector('#box').querySelector('button').addEventListener('click', clickButton)

    setTimeout(() => {
      document.body.querySelector('#box').textContent = ''

      document.body.querySelector('#box').innerHTML = '<button>按钮2</button>'
    }, 3000)
  </script>
</body>

</html>